<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
        <script type="text/javascript">
            function updateContractType(code, name)
            {
                document.getElementById('incontracts:code').value = code;
                document.getElementById('incontracts:name').value = name;
            }
            function showpdf() {
                window.open("./contract/pubinfo/contractpdf.jsf", "合同类型", "height=280,width=600,toolbar=no,menubar=no,scrollbars=no");
            }
        </script>
        <style type="text/css">
            .pic{
                margin-bottom: -4px;
                margin-right: -2px;
                border:none;
            }
            .odd-row {
                background-color: #ECF3FE;
            }
            .even-row {
                background-color: #FCFFFE;
            }
            .active-row {
                background-color: #FFEBDA;
            }
            input[type='submit']{
                margin:3px 5px 3px 5px;
                padding:2px 5px 2px 5px;
            }
            .rf-cal-inp {
                width:110px;
                margin-left: 2px;
            }
        </style>
        <link href="./css/spreadsheet.css" rel="stylesheet" type="text/css" />
    </h:head>
    <h:body style="height:800px">
        <f:view>
            <rich:panel header="合同列表" styleClass="content-hight">
                <h:form id="incontracts">
                    <h:panelGroup  id="curTab">
                        <rich:tabPanel rendered="#{contractListBean.querybut}">
                            <rich:tab  header="查询条件" >
                                <h:panelGrid columns="4">                                    
                                    <h:outputLabel value="编号：" for="number"/>
                                    <h:inputText size="20" id="number" value="#{contractListBean.queryCondition.number}"/>
                                    <h:outputLabel value="合同类型：" for="name"/>
                                    <h:inputText size="20" id="name" onclick="showContracttype()"
                                                 value="#{contractListBean.queryCondition.contractType.name}"/>
                                    <h:outputLabel value="名称：" for="cname"/>
                                    <h:inputText size="20" id="cname" value="#{contractListBean.queryCondition.cname}"/>
                                    <h:outputLabel value="地点：" for="address"/>
                                    <h:inputText size="20" id="address" value="#{contractListBean.queryCondition.address}"/>
                                    <h:outputText value="签订日期："/>
                                    <h:panelGroup>
                                        <rich:calendar value="#{contractListBean.queryCondition.orderdatestart}"
                                                       locale="Locale.CHINA"
                                                       popup="true"
                                                       datePattern="yyyy-MM-dd"
                                                       showApplyButton="false"  style="width:200px"/>
                                        至
                                        <rich:calendar value="#{contractListBean.queryCondition.orderdateend}"
                                                       locale="Locale.CHINA"
                                                       popup="true"
                                                       datePattern="yyyy-MM-dd"
                                                       showApplyButton="false"  style="width:200px"/>
                                    </h:panelGroup>
                                    <h:outputText value="开始日期："/>
                                    <h:panelGroup>
                                        <rich:calendar value="#{contractListBean.queryCondition.startstart}"
                                                       locale="Locale.CHINA"
                                                       popup="true"
                                                       datePattern="yyyy-MM-dd"
                                                       showApplyButton="false"  style="width:200px"/>
                                        至
                                        <rich:calendar value="#{contractListBean.queryCondition.startend}"
                                                       locale="Locale.CHINA"
                                                       popup="true"
                                                       datePattern="yyyy-MM-dd"
                                                       showApplyButton="false"  style="width:200px"/>
                                    </h:panelGroup>
                                    <h:outputText value="截止日期："/>
                                    <h:panelGroup>
                                        <rich:calendar value="#{contractListBean.queryCondition.deadlinestart}"
                                                       locale="Locale.CHINA"
                                                       popup="true"
                                                       datePattern="yyyy-MM-dd"
                                                       showApplyButton="false"  style="width:200px"/>
                                        至
                                        <rich:calendar value="#{contractListBean.queryCondition.deadlineend}"
                                                       locale="Locale.CHINA"
                                                       popup="true"
                                                       datePattern="yyyy-MM-dd"
                                                       showApplyButton="false"  style="width:200px"/>
                                    </h:panelGroup>
                                    <h:outputText value="质保日期："/>
                                    <h:panelGroup>
                                        <rich:calendar value="#{contractListBean.queryCondition.warrantystart}"
                                                       locale="Locale.CHINA"
                                                       popup="true"
                                                       datePattern="yyyy-MM-dd"
                                                       showApplyButton="false"
                                                       inputStyle="inputClass"/>
                                        至
                                        <rich:calendar value="#{contractListBean.queryCondition.warrantyend}"
                                                       locale="Locale.CHINA"
                                                       popup="true"
                                                       datePattern="yyyy-MM-dd"
                                                       showApplyButton="false"  style="width:200px"/>
                                    </h:panelGroup>
                                    <h:outputLabel value="甲方：" for="nameA"/>
                                    <h:inputText size="20" id="nameA" value="#{contractListBean.queryCondition.nameA}"/>
                                    <h:outputLabel value="甲方法人：" for="nameAstand"/>
                                    <h:inputText size="20" id="nameAstand" value="#{contractListBean.queryCondition.nameAstand}"/>
                                    <h:outputLabel value="乙方：" for="nameB"/>
                                    <h:inputText size="20" id="nameB" value="#{contractListBean.queryCondition.partner.name}"/>
                                    <h:outputLabel value="乙方法人：" for="nameBstand"/>
                                    <h:inputText size="20" id="nameBstand" value="#{contractListBean.queryCondition.partner.legalPerson}"/>
                                    <h:outputLabel value="标的：" for="nameA"/>
                                    <h:panelGroup>
                                        <h:inputText size="20" id="targetstart" value="#{contractListBean.queryCondition.targetstart}"/>
                                        -<h:inputText size="20" id="targetend" value="#{contractListBean.queryCondition.targetend}"/>
                                    </h:panelGroup>
                                    <h:outputLabel value="质保金：" for="nameA"/>
                                    <h:panelGroup>
                                        <h:inputText size="20" id="quality_marginstart" value="#{contractListBean.queryCondition.quality_marginstart}"/>
                                        -<h:inputText size="20" id="quality_marginend" value="#{contractListBean.queryCondition.quality_marginend}"/>
                                    </h:panelGroup>
                                    <h:outputLabel value="违约金：" for="nameA"/>
                                    <h:panelGroup>
                                        <h:inputText size="20" id="penaltystart" value="#{contractListBean.queryCondition.penaltystart}"/>
                                        -<h:inputText size="20" id="penaltyend" value="#{contractListBean.queryCondition.penaltyend}"/>
                                    </h:panelGroup>
                                    <h:outputLabel value="其他事项：" for="other"/>
                                    <h:inputText size="20" id="other" value="#{contractListBean.queryCondition.other}"/>

                                    <h:outputText value="付款计划："/>
                                    <h:panelGroup>
                                        <rich:calendar value="#{contractListBean.queryCondition.date1_start}"
                                                       locale="Locale.CHINA"
                                                       popup="true"
                                                       datePattern="yyyy-MM-dd"
                                                       showApplyButton="false"
                                                       inputStyle="inputClass"/>
                                        至
                                        <rich:calendar value="#{contractListBean.queryCondition.date1_end}"
                                                       locale="Locale.CHINA"
                                                       popup="true"
                                                       datePattern="yyyy-MM-dd"
                                                       showApplyButton="false"  style="width:200px"/>
                                    </h:panelGroup>
                                    <h:outputLabel value="是否生效" for="isEffect"/>
                                    <h:selectOneMenu id="isEffect" value="#{contractListBean.queryCondition.isEffect}"
                                                     style="width:130px;">
                                        <f:selectItem itemLabel="全部" itemValue=""/>
                                        <f:selectItem itemLabel="生效" itemValue="1"/>
                                        <f:selectItem itemLabel="失效" itemValue="0"/>
                                    </h:selectOneMenu>
                                </h:panelGrid>
                                <h:inputHidden  id="code" value="#{contractListBean.queryCondition.contractType.code}"/>
                            </rich:tab>
                        </rich:tabPanel>
                        <a4j:commandButton value="查询" rendered="#{contractListBean.querybut}"
                                           action="#{contractListBean.query}"
                                           render="tableGroup"/>
                        <a4j:commandButton value="取消" rendered="#{contractListBean.querybut}"
                                           action="#{contractListBean.queryCancel}"
                                           render="tableGroup,curTab"/>
                        <a4j:commandButton value="隐藏" rendered="#{contractListBean.querybut}"
                                           action="#{contractListBean.hiddenbut}"
                                           render="curTab"/>
                        <a4j:commandButton value="显示" rendered="#{!contractListBean.querybut}"
                                           action="#{contractListBean.showbut}"
                                           render="curTab"/>
                    </h:panelGroup>

                    <h:panelGroup id="tableGroup">
                        <rich:dataScroller for="tableEdit" execute="@this" render="tableGroup"/>
                        <div style="width:750px;overflow: auto;">
                            <rich:dataTable id="tableEdit"
                                            value="#{contractListBean.contractModel}" var="incontract"
                                            rowClasses="list-row-odd,list-row-even"
                                            headerClass="table-header"
                                            rows="6"
                                            style="width:1200px;margin-bottom:5px;"
                                            noDataLabel="无数据">

                                <rich:column sortBy="#{incontract.number}">
                                    <f:facet name="header">编号</f:facet>
                                    <h:commandLink value="#{incontract.number}" action="#{contractListBean.execSelected}"/>
                                </rich:column>

                                <rich:column sortBy="#{incontract.cname}">
                                    <f:facet name="header">名称</f:facet>
                                    <h:outputText value="#{incontract.cname}">
                                    </h:outputText>
                                </rich:column>
                                <rich:column sortBy="#{incontract.contractTypeName}">
                                    <f:facet name="header">合同类别</f:facet>
                                    <h:outputText value="#{incontract.contractTypeName}">
                                    </h:outputText>
                                </rich:column>
                                <rich:column sortBy="#{incontract.address}">
                                    <f:facet name="header">地点</f:facet>
                                    <h:outputText value="#{incontract.address}">
                                    </h:outputText>
                                </rich:column>
                                <rich:column sortBy="#{incontract.orderdate}">
                                    <f:facet name="header">签订日期</f:facet>
                                    <h:outputText value="#{incontract.orderdate}">
                                        <f:convertDateTime dateStyle="medium"/>
                                    </h:outputText>
                                </rich:column>
                                <rich:column sortBy="#{incontract.start}">
                                    <f:facet name="header">开始日期</f:facet>
                                    <h:outputText value="#{incontract.start}">
                                        <f:convertDateTime dateStyle="medium"/>
                                    </h:outputText>
                                </rich:column>
                                <rich:column sortBy="#{incontract.deadline}">
                                    <f:facet name="header">截止日期</f:facet>
                                    <h:outputText value="#{incontract.deadline}">
                                        <f:convertDateTime dateStyle="medium"/>
                                    </h:outputText>
                                </rich:column>
                                <rich:column sortBy="#{incontract.warranty}">
                                    <f:facet name="header">质保日期</f:facet>
                                    <h:outputText value="#{incontract.warranty}">
                                        <f:convertDateTime dateStyle="medium"/>
                                    </h:outputText>
                                </rich:column>
                                <rich:column sortBy="#{incontract.nameA}">
                                    <f:facet name="header">甲方</f:facet>
                                    <h:outputText value="#{incontract.nameA}"/>
                                </rich:column>
                                <rich:column sortBy="#{incontract.nameAstand}">
                                    <f:facet name="header">甲方法人</f:facet>
                                    <h:outputText value="#{incontract.nameAstand}"/>
                                </rich:column>
                                <rich:column sortBy="#{incontract.partner.name}">
                                    <f:facet name="header">乙方</f:facet>
                                    <h:outputText value="#{incontract.partner.name}"/>
                                </rich:column>
                                <rich:column sortBy="#{incontract.partner.legalPerson}">
                                    <f:facet name="header">乙方法人</f:facet>
                                    <h:outputText value="#{incontract.partner.legalPerson}"/>
                                </rich:column>
                                <rich:column sortBy="#{incontract.target}">
                                    <f:facet name="header">标的</f:facet>
                                    <h:outputText value="#{incontract.target}"/>
                                </rich:column>
                                <rich:column sortBy="#{incontract.quality_margin}">
                                    <f:facet name="header">质保金</f:facet>
                                    <h:outputText value="#{incontract.quality_margin}"/>
                                </rich:column>
                                <rich:column sortBy="#{incontract.penalty}">
                                    <f:facet name="header">违约金</f:facet>
                                    <h:outputText value="#{incontract.penalty}"/>
                                </rich:column>
                                <rich:column sortBy="#{incontract.other}">
                                    <f:facet name="header">其他</f:facet>
                                    <h:outputText value="#{incontract.other}"/>
                                </rich:column>
                                <f:facet name="footer"></f:facet>
                            </rich:dataTable>

                            <rich:jQuery selector="#tableEdit tr:odd" query="addClass('odd-row')" />
                            <rich:jQuery selector="#tableEdit tr:even" query="addClass('even-row')" />
                            <rich:jQuery selector="#tableEdit tr"
                                         query="mouseover(function(){jQuery(this).addClass('active-row')})"/>
                            <rich:jQuery selector="#tableEdit tr"
                                         query="mouseout(function(){jQuery(this).removeClass('active-row')})"/>
                        </div>
                    </h:panelGroup>
                </h:form>
            </rich:panel>
        </f:view>
    </h:body>
</ui:composition>
